<template>
  <div></div>
</template>

<script>
import { mapGetters, mapActions } from "vuex";
import { getToken } from "@/utils/auth";

export default {
  computed: {
    ...mapGetters(["retailer_id", "staff"]),
  },
  methods: {
    ...mapActions(["setTabBarActive"]),
    redirect_url() {
      this.setTabBarActive(2);
      // sessionStorage.setItem("tabBarActive", 2);
      if (this.retailer_id > 0) {
        this.$router.push("/retailer");
      } else if (this.staff == 1) {
        const token = getToken();
        if (token) {
          this.$router.push("/dashboard");
        } else {
          this.$router.push("/staff_login");
        }
      } else {
        this.$router.push("/client");
      }
    },
  },
  created() {
    this.redirect_url();
  },
};
</script>
